<?php
class class_database
{
	var $dbHost = "localhost";
	var $dbUser = "root";
	var $dbPass = "";
	
	var $dbName = "mheaven";
	var $tableNews = "news"; 
	var $tableMess = "mess";
	var $conn;
	var $result;
//	var $affectedRows ;
	
	 
	public function construct($dbHost,$dbUser,$dbPass,$dbName)
	{
		$this->dbHost = "$dbHost";
		$this->dbUser = "$dbUser";
		$this->dbPass = "$dbPass";
		$this->dbName = "$dbName";
	}

	public function dbChange($dbName)
	{
		$this->dbName = $dbName;
		$this->connect(); 
	}
	
	public function connect()
	{
		$conn = @mysql_connect($this->dbHost,$this->dbUser,$this->dbPass);
		if (!$this->conn) die ("Sorry! Can not link to database!");
		
	 	$this->result = @mysql_select_db("$this->dbName,$conn");
	}
	
	public  function dbQuery($query)
	{
		$result = @mysql_query($query);
		return $this->result;
	}	
	
	public function fetchArray()
	{
		return mysql_fetch_array($this->result);
	}
	
	public function affectedRows()
	{
		return mysql_affected_rows($this->result);
	}
	
	public function numRows()
	{
		return mysql_num_rows($this->result);
	}
	
	public function 
	
	public function closeDb()
	{
		mysql_close($this->conn);
	}
	
/*	public function delete($result)
	{
		mysql_query()
	}   */
}
?>